/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.concurrent.TimeUnit;

/**
 * <p>Project: javase2203 - T9
 * <p>Powered by webrx On 2022-08-09 11:41:57
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class T10 {

    static void work() {
        String t = Thread.currentThread().getName();
        for (int i = 0; i < (t.equals("T1") ? 15 : 5); i++) {
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (Exception e) {
                e.printStackTrace();
            }
            System.out.printf("%s:%02d%n", t, i);
        }
    }

    public static void main(String[] args) throws InterruptedException {
        //t1->t2->main(work())
        Thread t1 = new Thread(T10::work, "T1");
        t1.start();
        t1.join();
        Thread t2 = new Thread(T10::work, "T2");
        t2.start();
        //t2.join();
        work();
    }
}
